<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="AddRateDetail.aspx.vb" Inherits="GTSWeb_Carrier_Manage" title="GTS Frieght Management System" MaintainScrollPositionOnPostback="true" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder" Runat="Server">
<h3>Add Rate Detail</h3>
    <asp:Literal ID="Message" runat="server"></asp:Literal>
        <asp:Panel ID="pRateDetail" runat="server" Width="600px">
    <table style="width: 800px" border = "1">
    <tr valign="top" align="center"><td rowspan = "3" style="width: 330px">
    <asp:GridView ID="gdvwRateID" runat="server" AllowPaging="True" AllowSorting="True" CellPadding="4" DataKeyNames="RateID" EmptyDataText="No rate groups found." ForeColor="#333333" GridLines="None" Caption="Select a Rate Group" Width="400px">
        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <Columns>
            <asp:CommandField ShowSelectButton="True" />
        </Columns>
        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
        <EditRowStyle BackColor="#999999" />
        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
    </asp:GridView>
    </td>
            <td style="width: 129px" align="right">Select Rate Type:</td>
                <td style="width: 146px" align="left"><asp:DropDownList ID="ddlRateType" runat="server" AutoPostBack="True" DataSourceID="RateType" DataTextField="RateTypeName" DataValueField="RateTypeID" AppendDataBoundItems="True" Width="160px">
                <asp:ListItem Value="-1">Select a Rate Type</asp:ListItem>
                </asp:DropDownList></td>
        </tr>
        <tr valign="top">
            <td style="width: 129px" align="right">Select Service Type:</td>
            <td style="width: 146px" align="left"><asp:RadioButtonList ID="radServiceType" runat="server" DataSourceID="ServiceType" DataTextField="ServiceTypeName" DataValueField="ServiceTypeID" Width="160px">
                </asp:RadioButtonList>&nbsp;
                </td>
        </tr>

    </table>
        <asp:Panel ID="pFixed" runat="server">
            Fixed Rate<br />
            <table border="1">
                <tr align="center">
                    <td style="width: 159px">Minimum Weight</td>
                    <td>Maximum Weight</td>
                    <td>Rate Charge</td>
                </tr>
                <tr align="center">
                    <td style="width: 159px"><asp:TextBox ID="txtFMinWeight" runat="server"></asp:TextBox>
                        </td>
                    <td><asp:TextBox ID="txtFMaxWeight" runat="server"></asp:TextBox>
                        </td>
                    <td><asp:TextBox ID="txtFRateCharge" runat="server"></asp:TextBox>
                        </td>
                </tr>
            </table>
            <asp:LinkButton ID="linkAddFixed" runat="server">Add Fixed Rate</asp:LinkButton>
            <asp:Label ID="FMessage" runat="server" ForeColor="Red"></asp:Label></asp:Panel>
        <asp:Panel ID="pIncremental" runat="server">
            Incremental Rate<br />
            <table border="1">
                <tr align="center">
                    <td>Minimum Weight</td>
                    <td>Maximum Weight</td>
                    <td>Minimum Charge</td>
                    <td>Rate Charge</td>
                </tr>
                <tr align="center">
                    <td><asp:TextBox ID="txtIMinWeight" runat="server"></asp:TextBox>
                        </td>
                    <td><asp:TextBox ID="txtIMaxWeight" runat="server"></asp:TextBox>
                        </td>
                    <td>
                        <asp:TextBox ID="txtIMinCharge" runat="server"></asp:TextBox>
                        </td>
                    <td>
                        <asp:TextBox ID="txtIRateCharge" runat="server">
                        </asp:TextBox>
                        </td>
                </tr>
            </table>
            <asp:LinkButton ID="linkAddIncremental" runat="server" Width="144px">Add Incremental Rate</asp:LinkButton>
            <asp:Label ID="IMessage" runat="server" ForeColor="Red"></asp:Label></asp:Panel>
        <asp:Panel ID="pBase" runat="server">
            Base Rate<br />
            <table border="1">
                <tr align="center">
                    <td style="width: 160px">Minimum Weight</td>
                    <td>Maximum Weight</td>
                    <td>Base Rate</td>
                    <td>Rate Charge</td>
                </tr>
                <tr align="center">
                    <td style="width: 160px"><asp:TextBox ID="txtBMinWeight" runat="server"></asp:TextBox>
                        </td>
                    <td><asp:TextBox ID="txtBMaxWeight" runat="server"></asp:TextBox>
                        </td>
                    <td><asp:TextBox ID="txtBBaseRate" runat="server"></asp:TextBox></td>
                    <td><asp:TextBox ID="txtBRateCharge" runat="server"></asp:TextBox>
                        </td>
                </tr>
            </table>
            <asp:LinkButton ID="linkAddBase" runat="server">Add Base Rate</asp:LinkButton>
            <asp:Label ID="BMessage" runat="server" ForeColor="Red"></asp:Label></asp:Panel>       
        <asp:ObjectDataSource ID="RateType" runat="server" OldValuesParameterFormatString="{0}"
            SelectMethod="GetRateType" TypeName="GTSSystem.BLL.RateType"></asp:ObjectDataSource>
    <asp:ObjectDataSource ID="ServiceType" runat="server" OldValuesParameterFormatString="{0}"
                    SelectMethod="GetServiceType" TypeName="GTSSystem.BLL.ServiceType"></asp:ObjectDataSource>
            <br />
            <asp:GridView ID="gdvwRateDetail" runat="server" AutoGenerateColumns="False"
                CellPadding="4" DataKeyNames="RateDetailID" DataSourceID="RateDetailINFO" ForeColor="#333333"
                GridLines="None" Width="768px" AllowPaging="True" Caption="Rate Details for Selected Rate Group">
                <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <Columns>
                    <asp:CommandField ShowEditButton="True" />
                    <asp:BoundField DataField="RateDetailID" HeaderText="RateDetailID" SortExpression="RateDetailID"
                        Visible="False" />
                    <asp:TemplateField HeaderText="Min. Weight" SortExpression="MinWeight">
                        <ItemTemplate>
                            <asp:Label ID="Label1" runat="server" Text='<%# Bind("MinWeight") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Max. Weight" SortExpression="MaxWeight">
                        <ItemTemplate>
                            <asp:Label ID="Label2" runat="server" Text='<%# Bind("MaxWeight") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField DataField="Price" HeaderText="Price" DataFormatString="{0:C}" SortExpression="Price" HtmlEncode="False" />
                    <asp:BoundField DataField="BaseRate" HeaderText="Base Rate" DataFormatString="{0:C}" SortExpression="BaseRate" HtmlEncode="False" />
                    <asp:BoundField DataField="MinCharge" HeaderText="Min Charge" DataFormatString="{0:C}" SortExpression="MinCharge" HtmlEncode="False" />
                    <asp:BoundField DataField="RateTypeName" HeaderText="Rate Type" ReadOnly="True" SortExpression="RateTypeName" />
                    <asp:BoundField DataField="ServiceTypeName" HeaderText="Service Type" ReadOnly="True"
                        SortExpression="ServiceTypeName" />
                </Columns>
                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                <EditRowStyle BackColor="#999999" />
                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
            </asp:GridView>
            <asp:ObjectDataSource ID="RateDetailINFO" runat="server" OldValuesParameterFormatString="{0}"
                SelectMethod="GetRateDetailINFOByRateID" TypeName="GTSSystem.BLL.Rates" UpdateMethod="UpdateRateDetail" InsertMethod="AddRateSurcharge">
                <SelectParameters>
                    <asp:ControlParameter ControlID="gdvwRateID" Name="RateID" PropertyName="SelectedValue"
                        Type="Int32" />
                </SelectParameters>
                <UpdateParameters>
                    <asp:Parameter Name="RateDetailID" Type="Int32" />
                    <asp:Parameter Name="RateCharge" Type="Double" />
                    <asp:Parameter Name="MinCharge" Type="Double" />
                    <asp:Parameter Name="BaseRate" Type="Double" />
                </UpdateParameters>
                <InsertParameters>
                    <asp:Parameter Name="RateID" Type="Int32" />
                    <asp:Parameter Name="SurchargeID" Type="Int32" />
                    <asp:Parameter Name="ExtraCharge" Type="Double" />
                    <asp:Parameter Name="ChargeType" Type="String" />
                </InsertParameters>
            </asp:ObjectDataSource>
            &nbsp; &nbsp;
            &nbsp;
            &nbsp;&nbsp;
    </asp:Panel>
</asp:Content>

